package com.qiaoanju.back.dao.system;

import com.qiaoanju.back.domain.system.DictModel;
import com.qiaoanju.dao.SqlMapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * Created by eversec on 2017/10/21.
 */
public interface IDictDao extends SqlMapper {


    @Insert("insert into t_dict(pid,item_key,item_value, enable,remark,update_time, create_id,update_id) values(#{pid},#{item_key},#{item_value}, #{enable}, #{remark}," +
            "#{update_time}, #{create_id}, #{update_id})")
    int insert(DictModel dict);

    @Select("select * from t_dict ")
    List<DictModel> getDictsList(Map<String, Object> params);

    @Delete("delete from t_dict where id = #{id}")
    int deleteById(int id);

    @Select("select * from t_dict where id = #{id}")
    DictModel getDictById(int id);

    @Update("update t_dict set pid = #{pid},item_key = #{item_key},item_value = #{item_value}, enable = #{enable}, remark = #{remark}," +
            "update_time = #{update_time},update_id = #{update_id} where id = #{id}")
    boolean edit(DictModel editModel);

    /**
     * 批量删除
     * @param ids
     * @return
     */
    int deleteByIds(int[] ids);
}
